from flask import Flask
from models import db
from flask_cors import CORS

def create_app(config):
    flask_app = Flask(__name__)
    flask_app.config.from_object(config)
    # 初始化数据库
    db.init_app(flask_app)
    # 跨域
    CORS(flask_app)
    # 注册蓝图
    from views.views import user_blue
    flask_app.register_blueprint(user_blue)
    return flask_app